//Wednesday, September 28, 2011 18:08 PDT
import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;
import java.awt.geom.*;

public class BinaryCards
{
	public long largestNumber(long A, long B) {
	    for (int i=60; i>=0; --i)	// 60 = ceil( log2(10 ^ 18) )
	        if ( ((A^B) & (1L<<i) ) != 0)
	            return A | ((1L<<(i+1))-1);
    	return A;
    }
    	
	
}
//Powered by [KawigiEdit] 2.0!
